<?php 

require_once('getconfig.php');

Class Model_cast extends Dbo_DbManager
 {

	protected $C_CAST;
	protected $N_CASTCOUNT;
	

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getCast()
	{
		return  $this->C_CAST;
	}
	public function getCastcount()
	{
		return  $this->N_CASTCOUNT;
	}	

	public function setCast($C_CAST)
	{
		$this->C_CAST=$C_CAST;
	}
	public function setCastcount($N_CASTCOUNT)
	{
		$this->N_CASTCOUNT=$N_CASTCOUNT;
	}	

	public function write()
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_cast)
	{
		$objModel_cast = new Model_cast(FALSE);
		@$objModel_cast->setCast($arrModel_cast['C_CAST']);
		@$objModel_cast->setCastcount($arrModel_cast['N_CASTCOUNT']);

		return $objModel_cast;
 	 } 	 
    
     public static function get_cast($religion){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
	echo	$qry="select * from cast where C_RELIGION='$religion'";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
     public static function get_Businesslist_indivigual($typeofbusiness){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select C_CAST from businesslist where C_TYPE='$typeofbusiness' ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
		
     public static function get_Memberscount($businessinfo){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select N_CASTCOUNT from businesslist where C_CAST='$businessinfo' ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}	

 }
 ?>